Actually commit the fixes I meant to make BEFORE that run...
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 13 Feb 2014 03:19:34 +0000 (03:19 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 13 Feb 2014 03:19:34 +0000 (03:19 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4736 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/bcr.cc
gpsbabel/compegps.cc
gpsbabel/defs.h
gpsbabel/dmtlog.cc
gpsbabel/garmin_gpi.cc
gpsbabel/garmin_tables.cc
gpsbabel/grtcirc.cc
gpsbabel/jeeps/gpsmath.cc
gpsbabel/trackfilter.cc

index f76b383ecef52117966a09d084dd5f0d47b9d10d..f84e9998786ed7735a4f1241428b287ec6b3e52d 100644 (file)
@@ -481,7 +481,7 @@ bcr_route_header(const route_head* route)
       s2 = csv_stringclean(s2, ",\t\r\n");
     }
 
-    if (s2.isEmpty()) {
+    if (sout.isEmpty()) {
       sout = QString("%1,%2,@,0").arg(s1).arg(s1);
     } else {
       sout = QString("%1,%2,@,0").arg(s1).arg(s2);
index 758c1c33932ed9ef77a77b7c7a9250321dbbfe10..77a2eea04c2b1991cc438cffd4f972f5481c85de 100644 (file)
@@ -209,6 +209,7 @@ parse_wpt(char* buff)
           compegps_parse_time(c, &tm);
           wpt->SetCreationTime(mkgmtime(&tm));
         }
+        break;
       case 6:
         wpt->altitude = atof(c);
         break;
index f6110de4f27f1a68044aaee7508a556b8b7db4ab..f7c44c08e095b44de9c50510eed9c6fca816f51d 100644 (file)
@@ -376,7 +376,7 @@ public:
   wp_flags() :
     shortname_is_synthetic(0),
     cet_converted(0),
-    fmt_use(0),
+    fmt_use(1),
     temperature(0),
     proximity(0),
     course(0),
index de6dfa082c426ffdcf777a262e9172613b1acab0..7a98213ce2912285e150604894e100757ff1837b 100644 (file)
@@ -429,7 +429,6 @@ read_CTrackFile(const int version)
   int32_t ux;
   route_head* track;
   int i;
-  int datum;
 
   u1 = gbfgetint16(fin);
 
@@ -461,6 +460,7 @@ read_CTrackFile(const int version)
   }
 
   tcount = gbfgetint32(fin);
+  int datum = 118;
   if (tcount > 0) {
     datum = read_datum(fin);
     if (version == 8) {
@@ -487,6 +487,9 @@ read_CTrackFile(const int version)
     wpt->longitude = gbfgetdbl(fin);
     wpt->altitude = gbfgetdbl(fin);
 
+    if (datum < 0) {
+      fatal(MYNAME ": Invalid datum %d found", datum);
+    }
     convert_datum(wpt, datum);
 
     track_add_wpt(track, wpt);
index 7217bd8a1de6d46d99ab9985717eb9614d33e03a..68867a521be2ea6fec615f8a4a5d2cff13a38f56 100644 (file)
@@ -633,6 +633,7 @@ read_tag(const char* caller, const int tag, Waypoint* wpt)
 
   case 0x8000b:        /* address (street/city...) */
     (void) gbfgetint32(fin);
+    // FALLTHROUGH
   case 0xb:    /* as seen in German POI files. */
     PP;
     mask = gbfgetint16(fin); /* address fields mask */
index d0f85a7016ac01bc66179535fbaab1a79156839b..613de3149d457f3fe53f9435c3714c0546db6a01 100644 (file)
@@ -684,6 +684,7 @@ gt_switch_display_mode_value(const unsigned char display_mode, const int protoid
     case 109:
     case 110:
       return display_mode & 3;
+      break;
     case 104:
       switch (display_mode) {
       case 0:
index f2f5509d378d325fd481ffbd13467dfc5f22100a..2444a1908ecefbd5261af885d81d97bf3f617da0 100644 (file)
@@ -296,7 +296,6 @@ double linedistprj(double lat1, double lon1,
       return 0;
     }
   }
-  return 0;
 }
 
 
index efb09c881fac48f9a6078ac421adc50d7fee6f84..b743a17942191db7f4d7d90016f6fdbd84778224 100644 (file)
@@ -1096,6 +1096,9 @@ int32 GPS_Math_WGS84_To_ICS_EN(double lat, double lon, double* E,
   double phi, lambda, alt, a, b;
 
   int32 datum   = GPS_Lookup_Datum_Index("Palestine 1923");
+  if (datum < 0) {
+    fatal("Unable to find Palestine 1923 in internal tables");
+  }
   int32 ellipse = GPS_Datum[datum].ellipse;
 
   a = GPS_Ellipse[ellipse].a;
@@ -1129,6 +1132,9 @@ void GPS_Math_ICS_EN_To_WGS84(double E, double N, double* lat, double* lon)
   double const N0      = 1126867.909;
   double phi, lambda, alt, a, b;
   int32 datum   = GPS_Lookup_Datum_Index("Palestine 1923");
+  if (datum < 0) {
+    fatal("Unable to find Palestine 1923 in internal tables");
+  }
   int32 ellipse = GPS_Datum[datum].ellipse;
 
   a = GPS_Ellipse[ellipse].a;
index 1206d90b587a3f5ce7d83a3649959fedcd09e67b..c9cad014f580806175a4f3eb2b3724c0e3389c50 100644 (file)
@@ -417,8 +417,6 @@ trackfilter_split_init_rte_name(route_head* track, const QDateTime dt)
 static void
 trackfilter_pack_init_rte_name(route_head* track, const time_t default_time)
 {
-  char buff[128];
-
   if (strchr(opt_title, '%') != NULL) {
     struct tm tm;
     Waypoint* wpt;
@@ -430,11 +428,12 @@ trackfilter_pack_init_rte_name(route_head* track, const time_t default_time)
       time_t t = wpt->GetCreationTime().toTime_t();
       tm = *localtime(&t);
     }
+    char buff[128];
     strftime(buff, sizeof(buff), opt_title, &tm);
+    track->rte_name = buff;
   } else {
-    strncpy(buff, opt_title, sizeof(buff));
+    track->rte_name = opt_title;
   }
-  track->rte_name = buff;
 }
 
 /*******************************************************************************